require(['./config'],()=>{
    require(['template','swiper','header','footer'],(template,Swiper)=>{
        class Index{
            constructor(){
                this.getCategory()
                this.swiper()
            }
            // 获取数据
            getCategory(){
                $.get('/libs/json/homeCategory.json',resp=>{
                    this.renderCategary(resp)
                })
            }
            //渲染数据
            renderCategary(list){
              const html= template('categoryTemplate',{list})
              $('#categoryList').html(html);

            }
            swiper(){
                var mySwiper = new Swiper('.swiper-container', {
                    autoplay: 3000,//可选选项，自动滑动
                    // direction : 'vertical', // 垂直切换
                    speed:1000,
                    pagination : '.swiper-pagination',
                    prevButton:'.swiper-button-prev',
                    nextButton:'.swiper-button-next',
                    loop: true,
                    effect : 'cube'
                  })
            }
        }
        new Index()
    })
})